package com.ctz.commonframe.ui;

import android.app.Application;
import android.content.Context;

import com.ctz.commonframe.utils.Logger;
import com.ctz.commonframe.utils.SharedPrefrencesUtil;
import com.tencent.smtt.sdk.QbSdk;
import com.uuzuche.lib_zxing.activity.ZXingLibrary;

import org.xutils.x;

/**
 * Created by 陈堂正 on 2016/11/24.
 */
public class BaseApplication extends Application {
    protected static BaseApplication instance;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        x.Ext.init(instance);
        Logger.init(getApplicationContext());
        ZXingLibrary.initDisplayOpinion(getApplicationContext());
        SharedPrefrencesUtil.init(getApplicationContext());
        //x5内核初始化接口
//        QbSdk.initX5Environment(getApplicationContext(), new QbSdk.PreInitCallback() {
//
//            @Override
//            public void onViewInitFinished(boolean arg0) {
//                //x5內核初始化完成的回调，为true表示x5内核加载成功，否则表示x5内核加载失败，会自动切换到系统内核。
//                Logger.e(arg0 ? "x5内核加载成功" : "x5内核加载失败，使用系统内核");
//            }
//
//            @Override
//            public void onCoreInitFinished() {
//            }
//        });
    }

    public static Context getContext(){
        if (instance == null) {
            return null;
        }
        return instance.getApplicationContext();
    }
}
